using System;
using System.ComponentModel.DataAnnotations.Schema;
using hao_Common.Dapper.Repository;
using hao_Model.Enums;

namespace hao_Model
{
    /// <summary>
    /// 订单实体
    /// </summary>
    [Table("Orders")]
    public class Order : ISoftDelete
    {
        public Guid Id { get; set; }
        public string OrderNumber { get; set; }
        public Guid BuyerId { get; set; }
        public Guid SellerId { get; set; }
        public Guid ProductId { get; set; }
        public string ProductTitle { get; set; }
        public decimal ProductPrice { get; set; }
        public decimal FinalPrice { get; set; }
        public int Quantity { get; set; } = 1;
        public decimal TotalAmount { get; set; }
        public DeliveryMethod DeliveryMethod { get; set; }
        public OrderStatus Status { get; set; }
        public PaymentStatus PaymentStatus { get; set; }
        public DeliveryStatus DeliveryStatus { get; set; }
        public string TrackingNumber { get; set; }
        public Guid? BuyerAddressId { get; set; }
        public string BuyerMessage { get; set; }
        public string SellerMessage { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
        public DateTime? PaidAt { get; set; }
        public DateTime? ShippedAt { get; set; }
        public DateTime? DeliveredAt { get; set; }
        public DateTime? CompletedAt { get; set; }
        public DateTime? CancelledAt { get; set; }
        public string CancelReason { get; set; }
        public bool IsDeleted { get; set; }
    }

    /// <summary>
    /// 订单状态日志实体
    /// </summary>
    [Table("OrderStatusLogs")]
    public class OrderStatusLog
    {
        public Guid Id { get; set; }
        public Guid OrderId { get; set; }
        public OrderStatus? FromStatus { get; set; }
        public OrderStatus ToStatus { get; set; }
        public Guid? OperatorId { get; set; }
        public OperatorType OperatorType { get; set; }
        public string Reason { get; set; }
        public string Remark { get; set; }
        public DateTime CreatedAt { get; set; }
    }

    /// <summary>
    /// 订单评价实体
    /// </summary>
    [Table("OrderReviews")]
    public class OrderReview : ISoftDelete
    {
        public Guid Id { get; set; }
        public Guid OrderId { get; set; }
        public Guid ReviewerId { get; set; }
        public Guid RevieweeId { get; set; }
        public ReviewerType ReviewerType { get; set; }
        public int Rating { get; set; }
        public string Content { get; set; }
        public string Tags { get; set; }
        public string Images { get; set; }
        public bool IsAnonymous { get; set; }
        public DateTime CreatedAt { get; set; }
        public bool IsDeleted { get; set; }
    }
}